package ru.store.book;

import ru.store.Item;

public class Book extends Item {
	private String author = null;
	
	public Book(String title, String author, String isdn){
		super(isdn, "book", title, null, 0, 0, 0);
		this.author = author;
	}
	
	public Book(String title, String author, String isdn, String publisher){
		super(isdn, "book", title, publisher, 0, 0, 0);
		this.author = author;
	}
	
	public Book(String title, String author, String isdn, String publisher, int year){
		super(isdn, "book", title, publisher, year, 0, 0);
		this.author = author;
	}
	
	public Book(String title, String author, String isdn, String publisher, int year, 
			float price, int count){
		super(isdn, "book", title, publisher, year, price, count);
		this.author = author;
	}
	
	public void setAuthor(String author) {
		this.author = author;
	}

	public String getAuthor() {
		return author;
	}

	public void setTitle(String title) {
		setName(title);
	}

	public String getTitle() {
		return getName();
	}

	public void setIsdn(String isdn) {
		setId(isdn);
	}

	public String getIsdn() {
		return getId();
	}

	public void setPublisher(String publisher) {
		setVendor(publisher);
	}

	public String getPublisher() {
		return getVendor();
	}
	
	public String toString() {
		return getName() + (getVendor() != null ? "[" + getVendor() + "]" : "") + (getYear() != 0 ? "[" + String.valueOf(getYear()) + "]" : "");
	}
}
